package com.app.model.xml 
{

	import flash.filters.ConvolutionFilter;
	import flash.utils.Dictionary;
	import flash.xml.XMLDocument;
	
	import org.puremvc.as3.patterns.proxy.Proxy;
	import org.puremvc.as3.interfaces.IProxy;
	
	import com.app.model.data.LevelData;
	import com.app.model.data.ServerData;

	public class AnalysisXMLProxy extends Proxy implements IProxy
	{
		public static const NAME:String = 'AnalysisXMLProxy';
		
		private static var _servers:Dictionary = new Dictionary();	//server
		
		private static var _levels:Dictionary = new Dictionary();	//等级
		
		public function AnalysisXMLProxy()
		{
			super(NAME);
		}
		
		/**
		 * 
		 * @param	xml
		 */
		public function analysisSystem(xml:XML):void
		{
			var llist:XMLList = xml.levels.level;
			var data:LevelData;
			for each(var xitem:XML in llist)
			{
				data = new LevelData(xitem);
				_levels[LevelData(data).id] = data;
				
				data = null;
			}
		}
		
		/**
		 * 
		 * @param	xml
		 */
		public function analysisServers(xml:XML):void
		{
			var llist:XMLList = xml.servers.server;
			var data:ServerData;
			for each(var xitem:XML in llist)
			{
				data = new ServerData(xitem);
				_servers[ServerData(data).sid] = data;
				
				data = null;
			}
		}
		
		public function get levels():Dictionary { return _levels; }
		public function get servers():Dictionary { return _servers; }
	}

}